﻿using Infrastructure;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App;
using OpenAuth.Repository.Domain;
using OpenAuth.Repository;
using System.Collections.Generic;
using System.Linq;
using log4net;
using Oracle.ManagedDataAccess.Client;
using System.Data;
using System;
using System.Reflection;


namespace OpenAuth.WebApi.Areas.HisApi.Controllers
{
    //[ApiController]
    /// <summary>
    /// 医院基础信息
    /// </summary>
    [Route("HisApi/[controller]/[action]")]
    [ApiController]
    public class BaseInfoController : ControllerBase
    {

        #region IActionResult说明
        //ActionResult继承了IActionResult

        //JsonResult、RedirectResult、FileResult、ViewResult、ContentResult均继承了ActionResult

        //所以IActionResult类型的函数可以返回所有直接继承和间接继承他的类型数据
        #endregion

        /// <summary>
        /// 医生信息查询对象
        /// </summary>
        private readonly CGGYW005App cggyw005App;
        /// <summary>
        /// 医院服务心跳线
        /// </summary>
        private readonly CGGYW009App cggyw009App;
       



        /// <summary>
        /// 注入构造函数
        /// </summary>
        /// <param name="_cggyw005App"></param>
        /// <param name="_cggyw009App"></param>
        public BaseInfoController(CGGYW005App _cggyw005App, CGGYW009App _cggyw009App)
        {
            cggyw005App = _cggyw005App;
            cggyw009App = _cggyw009App;
            


        }

        /// <summary>
        /// 医生信息查询接口///卫宁文档里没返回示例
        /// </summary>
        /// <param name="ysdm"></param>
        /// <returns></returns>
        [HttpGet]
        public Response QueryDocByYsdm(string ysdm)
        {

            //新建返回json容器
            var result = new Response<List<CGGYW005>>();
            //查询医生信息
            var queryResult = cggyw005App.QueryCGGYW005(ysdm);
            if (queryResult.Count() < 1)
            {
                result.Code = 400;
                result.Message = "没有查询到医生信息";
            }
            else
            {
                result.Result = queryResult.ToList();
            }

            return result;
        }

        /// <summary>
        /// 医院服务心跳线接口
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Response QueryOnline()
        {
            //新建返回json容器
            var result = new Response<List<CGGYW009>>();
            //查询医生信息
            var queryResult = cggyw009App.QueryCGGYW009();
            result.Result = queryResult.ToList();
            return result;
        }
       
   



    }
  
}